function askQuestion() {
    const question = document.getElementById('questionInput').value;
    if (question) {
        // 发送请求到后端API
        fetch('http://127.0.0.1:5000/api/answer', {
            method: 'POST',
            headers: {
                'Content-Type': 'application/json',
            },
            body: JSON.stringify({ question: question }),
        })
        .then(response => response.json())
        .then(data => {
            const answerContainer = document.getElementById('answerContainer');
            answerContainer.innerHTML = `<p>${data.answer}</p>`;
        })
        .catch(error => {
            console.error('Error:', error);
        });
    } else {
        alert('请输入一个问题！');
    }
}